export default class Box{
    constructor(el,data){
        this.el = document.querySelector(el);
        this.title = data.title;
        this.list = data.list;
        this.render();//构造函数中调用render函数，实现new一个实例过后自动渲染到页面上
    }

    render(){
        this.el.querySelector('ul').innerHTML = this.list.map(item=>`<li>${item}</li>`).join('');
        this.el.querySelector('h2').innerHTML = this.title;
    }
}